package com.example.controller;


import com.example.pojo.Result;
import com.example.service.InteractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/interact")
public class InteractController {
    @Autowired
    private InteractService interactService;

    //点赞

    @RequestMapping("/like")
    public Result like(@RequestParam Integer id){
        interactService.like(id);
        return Result.success();
    }
    //取消点赞
    @RequestMapping("/unlike")
    public Result unlike(@RequestParam Integer id){
        interactService.unlike(id);
        return Result.success();
    }
    //收藏
    @RequestMapping("/collect")
    public Result collect(@RequestParam Integer id){
        interactService.collect(id);
        return Result.success();
    }
    //取消收藏
    @RequestMapping("/uncollect")
    public Result uncollect(@RequestParam Integer id){
        interactService.uncollect(id);
        return Result.success();
    }

    //查看我的喜欢
    @RequestMapping("/mylike")
    public Result mylike(){
        return Result.success(interactService.mylike());
    }

    //查看我的收藏
    @RequestMapping("/mycollect")
    public Result mycollect(){
        return Result.success(interactService.mycollect());
    }








}
